package cn.mrcode.fd.blog.enu;

/**
 * @author zhuqiang
 */
public enum AccountError{
    SYSTEM_ERROR(-1,"系统错误"),
    ACCOUNT_NOT_CANUSE(100,"账户不可用,已被占用/禁用"),
    EMAIL_NOT_CANUSE(101,"邮箱已被占用");
    private int code;
    private String info;

    AccountError(int code, String info) {
        this.code = code;
        this.info = info;
    }

    public String getInfo() {
        return info;
    }
    public int getCode() {
        return code;
    }

    public String codeOf(int code){
        for (AccountError err: AccountError.values()) {
            if(err.getCode() == code){
                return err.getInfo();
            }
        }
        return null;
    }
}
